# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# from AUR - adjusted to our styles.
#
# Maintainer: tobias <tobias@archlinux.org>

pkgname=gtk-sharp-2
_pkgname=gtk-sharp
pkgver=2.12.45
pkgrel=5
pkgdesc='Gtk2 bindings for C#.'
arch=('x86_64' 'aarch64')
license=('LGPL-2.0-or-later')
url='https://www.mono-project.com/docs/gui/gtksharp/'
depends=('mono' 'gtk2')
makedepends=('monodoc')
optdepends=('perl: for gapi2xml.pl and gapi_pp.pl')
options=('!makeflags')
source=("https://download.mono-project.com/sources/gtk-sharp212/$_pkgname-$pkgver.tar.gz"
        'gtk-sharp2-2.12.12-gtkrange.patch'
        'gtk-sharp2-2.12-pointer-cast.patch')
sha512sums=('6e11a6a3e8f7f3f9511c674cdcbda15274e597b8e72bc2cdd6970f8906e295849a94108794c11b9aef5408631bf10d2dd7d855d5e5081f58fc790e7194f6159f'
            '6bdd538bfd97eea980d0b2beabee9f3eda9839da3d46d7daaa6373af853419a8ad535c02d8b882db3d001daeb996e78c6ccf604c899026fed82dbae3938483e3'
            '7ab0e8cb0b52228727d9c679092aad3c2bd8c70de1312c6b21f478388eb8db294c9d9c1968c7b239110180e3fda88eecffa8a09a859850c1421f70d0c9ebf960')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -Np1 -i ../gtk-sharp2-2.12.12-gtkrange.patch
  patch -Np1 -i ../gtk-sharp2-2.12-pointer-cast.patch
}

build() {
  cd "$_pkgname-$pkgver"

  ./configure --prefix=/usr --sysconfdir=/etc --disable-static

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install
}

